<!-- saved from url=(0022)http://internet.e-mail -->
<%@ page import="java.sql.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Purchase Summary</title>
<style type="text/css">
<!--
.style3 {
	font-family: Arial;
	font-size: 12px;
}
-->
</style>
</head>
<body>
	  <table width="100%" height = "30"  border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFBF0">
<%
int dLoop=0;
ResultSet Rs = task.fetchContractList();
int R_id = 0;
String Colour="";
float pending = 0;
float unfixed = 0;
while (Rs.next())
{
		R_id = Rs.getInt("id");
		pending = Rs.getFloat("Tons")-Rs.getFloat("receive_tons");
		unfixed = Rs.getFloat("unfixed_tons");
		if ((pending > 0) && (unfixed > 0)) Colour = "#FF0000";
		if ((pending == 0) && (unfixed > 0)) Colour = "#FFFF66";
		if ((pending > 0) && (unfixed == 0)) Colour = "#33CCFF";
		if ((pending == 0) && (unfixed == 0)) Colour = "#000011";
%>
        <tr id=<%=R_id%> onDblClick="cardViewClick(this);" onClick="highlightOn(this);">
          <td width="2%" align="center"><span class="style3"><%=Rs.getInt("id")%></span></td>
          <td width="8%" style="color:<%=Colour%>" align="center"><span class="style3"><%=Rs.getString("ref_number")%></span></td>
          <td width="8%" style="color:<%=Colour%>" align="center"><span class="style3"><%=Rs.getString("contract_no")%></span></td>		  
          <td width="9%" align="left"><span class="style3"><%=task.getFieldValueForId("origin_master","name",Rs.getInt("origin_id"))%></span></td>
          <td width="15%" align="left"><span class="style3"><%=task.getFieldValueForId("grade_master","name",Rs.getInt("grade_id"))%></span></td>
          <td width="12%" align="left"><span class="style3"><%=task.getFieldValueForId("company_master","name",Rs.getInt("supplier_buyer_id"))%></span></td>
          <td width="8%" align="center"><span class="style3"><%=Utils.dateToStr(Rs.getDate("first_date"))%></span></td>
          <td width="8%" align="center"><span class="style3"><%=Utils.dateToStr(Rs.getDate("last_date"))%></span></td>
          <td width="6%" align="right"><span class="style3"><%=Utils.numberToStr(Rs.getFloat("tons"),3)%></span></td>
		  <%
		  if (Rs.getString("type").compareTo("P")==0) 
		  {
		  	pur_ton=pur_ton + Rs.getFloat("tons");
			pur_delvd=pur_delvd + Rs.getFloat("receive_tons");
			pur_pend=pur_pend + (Rs.getFloat("Tons")-Rs.getFloat("receive_tons"));
		  }
		  if (Rs.getString("type").compareTo("S")==0) 
		  {
		  	sal_ton=sal_ton + Rs.getFloat("tons");
			sal_delvd=sal_delvd + Rs.getFloat("receive_tons");
			sal_pend=sal_pend + (Rs.getFloat("Tons")-Rs.getFloat("receive_tons"));
		  }
		  
		  %>
          <td width="6%" align="right"><span class="style3"><%=Utils.numberToStr(Rs.getFloat("receive_tons"),3)%></span></td>		  
          <td width="5%" align="right"><span class="style3"><%=Utils.numberToStr(Rs.getFloat("Tons")-Rs.getFloat("receive_tons"),3)%></span></td>
          <td width="7%" align="right"><span class="style3"><%//=Utils.numberToStr(Rs.getFloat("basis_outright"),2)%></span></td>		  
          <td width="6%" align="right"><span class="style3"><%//=Utils.numberToStr(Rs.getFloat("basis_diff"),2)%></span></td>
        </tr>
<%
		dLoop=dLoop+1;
}
%>
</table>
</body>
</html>
